<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
   
  <meta name="keywords" content="Java Python" />
   
  <meta name="description" content="From Zero to Hero" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    计算机组成原理-04-数据的表示 |  朱酱酱的学习博客
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/style.css">

  
<script src="/js/pace.min.js"></script>


  

  

<link rel="alternate" href="/atom.xml" title="朱酱酱的学习博客" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-Compute_Organization/计组-04-数据的表示" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  计算机组成原理-04-数据的表示
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2021/03/27/Compute_Organization/%E8%AE%A1%E7%BB%84-04-%E6%95%B0%E6%8D%AE%E7%9A%84%E8%A1%A8%E7%A4%BA/" class="article-date">
  <time datetime="2021-03-27T03:02:24.000Z" itemprop="datePublished">2021-03-27</time>
</a>
      
      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.7k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">6分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="计算机组成原理-04-数据的表示"><a href="#计算机组成原理-04-数据的表示" class="headerlink" title="计算机组成原理-04-数据的表示"></a>计算机组成原理-04-数据的表示</h2><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-205829908.png" alt="mark"></p>
<h2 id="1-定点数和浮点数的区别"><a href="#1-定点数和浮点数的区别" class="headerlink" title="1. 定点数和浮点数的区别"></a>1. 定点数和浮点数的区别</h2><ul>
<li><p>根据小数点的位置是否固定，在计算机内有两种数据格式</p>
<ul>
<li>定点数</li>
<li>浮点数</li>
</ul>
</li>
<li><p>定点表示：约定机器数中的小数点位置固定不变，小数点不再用“,”表示，而是约定了它的位置</p>
</li>
</ul>
<h2 id="2-无符号数和有符号数"><a href="#2-无符号数和有符号数" class="headerlink" title="2. 无符号数和有符号数"></a>2. 无符号数和有符号数</h2><ul>
<li><strong>无符号数</strong>：指整个机器字长的全部二进制位均为数值位，没有符号位。若机器字长为8位，则数的表示范围 <code>0~2^8-1</code> , 即<code>0~255</code>。<ul>
<li>无符号数一般只代表整数，不代表小数</li>
</ul>
</li>
<li><strong>有符号数</strong>：在机器中，数的正负我们无法识别，但是我们可以用<strong>二进制数来代替正负号。一般‘0’为正，‘1’为负</strong>，符号位一般在有效数的最前面。若机器字长为8位，是有符号数，则数的表示范围为 -2^7<del>2^7-1 ，即-128</del>127。</li>
</ul>
<a id="more"></a>



<h2 id="3-定点数的表示"><a href="#3-定点数的表示" class="headerlink" title="3. 定点数的表示"></a>3. 定点数的表示</h2><ul>
<li>定点小数：一般将小数点的位置固定在数据的<code>最高位之前</code>。</li>
<li>定点整数：一般将小数点的位置固定在数据的<code>最低位之后</code>。</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-091024201.png" alt="mark"></p>
<h3 id="3-1-原码"><a href="#3-1-原码" class="headerlink" title="3.1 原码"></a>3.1 原码</h3><ul>
<li>用机器数的最高位来代表该数的符号，其余的各位表示数的绝对值    </li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-091658245.png" alt="mark"></p>
<h3 id="3-2-反码"><a href="#3-2-反码" class="headerlink" title="3.2 反码"></a>3.2 反码</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-091855834.png" alt="mark"></p>
<ul>
<li>反码通常用于原码求补码的中间过渡</li>
<li>反码<ul>
<li>若符号位为0，则反码和原码相同</li>
<li>若符号位为1，则数值位全部取反</li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-092022869.png" alt="mark"></p>
<h3 id="3-3-补码"><a href="#3-3-补码" class="headerlink" title="3.3 补码"></a>3.3 补码</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-093338403.png" alt="mark"></p>
<ul>
<li>正数的补码和原码相同</li>
<li>负数的补码<ul>
<li>先求出反码</li>
<li>反码的基础上+1（需要注意进位的问题）</li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-093400463.png" alt="mark"></p>
<ul>
<li>补码如何求原码？<ul>
<li>正数的补码和原码一样</li>
<li>负数 ：数值位全部取反，然后+1</li>
</ul>
</li>
</ul>
<h3 id="3-4-移码"><a href="#3-4-移码" class="headerlink" title="3.4 移码"></a>3.4 移码</h3><ul>
<li><strong>移码的特性：非常方便比较大小</strong></li>
<li>只能用于表示整数</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-093731979.png" alt="mark"></p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-093824082.png" alt="mark"></p>
<h3 id="3-5-例题小结"><a href="#3-5-例题小结" class="headerlink" title="3.5 例题小结"></a>3.5 例题小结</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-094010561.png" alt="mark"></p>
<ul>
<li><strong>如何从[x]补 求得 [-x]补</strong><ul>
<li>技巧：符号位 数值位 全部取反</li>
<li>并且末尾+1</li>
</ul>
</li>
<li><strong>转换技巧小结</strong></li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210328-094226591.png" alt="mark"></p>
<h2 id="4-补码的作用和由来"><a href="#4-补码的作用和由来" class="headerlink" title="4. 补码的作用和由来"></a>4. 补码的作用和由来</h2><ul>
<li><strong>原因：原码的加减法和无符号的加减法的差异</strong><ul>
<li>因此需要涉及一种算法：用加法代替减法</li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-204046237.png" alt="mark"></p>
<ul>
<li><strong>模m计算法则（详情请学习离散数学）</strong><ul>
<li>如采用时钟，则相当于对12取模（-3和9的地位是等价的）</li>
<li>(mod 12)相当于把所有的整数分为了12类（余数为0-11）</li>
<li>mod12 属于相同的数，都是属于同一类，是等价的</li>
<li><strong>图示如下：这样就相当于把-3 改为了 +9等等（加法代替了减法）</strong></li>
<li><strong>这里的 -3 和 9 互为补数，他们的绝对值之和是等于模的（12）</strong></li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-204307371.png" alt="mark"></p>
<ul>
<li>如计算机的<strong>机器字长是8bit</strong>，那么超出这个范围的话，只保留8为，那么就<strong>相当于mod 2^8 的条件</strong><ul>
<li>那么<strong>补数 = 2^8 - 负数的绝对值</strong></li>
<li><strong>补数 就是 补码的原生定义</strong></li>
<li>针对上个例子如图所示</li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-205012290.png" alt="mark"></p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-205148396.png" alt="mark"></p>
<ul>
<li><strong>再来看个例子</strong><ul>
<li>补码的加减法：符号位一起加入计算</li>
<li>注意：加法会有溢出的产生</li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-205556014.png" alt="mark"></p>
<h2 id="5-定点数的移位运算"><a href="#5-定点数的移位运算" class="headerlink" title="5. 定点数的移位运算"></a>5. 定点数的移位运算</h2><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-205917524.png" alt="mark"></p>
<h3 id="5-1-算数移位"><a href="#5-1-算数移位" class="headerlink" title="5.1 算数移位"></a>5.1 算数移位</h3><h4 id="5-1-1-原码的移位规则"><a href="#5-1-1-原码的移位规则" class="headerlink" title="5.1.1 原码的移位规则"></a>5.1.1 原码的移位规则</h4><ol>
<li><strong>整数的算数右移</strong><ul>
<li>相当于除以2的操作</li>
<li>高位补0，低位舍弃</li>
<li>若舍弃的位不等于0，那么会造成精度的丢失</li>
</ul>
</li>
</ol>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-210129544.png" alt="mark"></p>
<ol start="2">
<li><strong>整数的算数左移</strong><ul>
<li>相当于乘以2的规则</li>
<li>低位补0，高位舍弃</li>
<li>若舍弃的位不等于0，则会造成严重的精度错误</li>
</ul>
</li>
</ol>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-210327660.png" alt="mark"></p>
<ol start="3">
<li><strong>小数的原理同整数</strong></li>
</ol>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-210550762.png" alt="mark"></p>
<h4 id="5-1-2-反码的算数移位"><a href="#5-1-2-反码的算数移位" class="headerlink" title="5.1.2 反码的算数移位"></a>5.1.2 反码的算数移位</h4><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-210741679.png" alt="mark"></p>
<ol>
<li><strong>正数的反码移位</strong></li>
</ol>
<ul>
<li>同原码</li>
</ul>
<ol start="2">
<li><strong>负数的反码移位</strong></li>
</ol>
<ul>
<li>右移除2，高位补1，低位舍弃</li>
<li>左移乘2，低位补1，高位舍弃</li>
<li>因为原码和反码的0和1互为相反</li>
</ul>
<h4 id="5-1-3-补码的算数移位"><a href="#5-1-3-补码的算数移位" class="headerlink" title="5.1.3 补码的算数移位"></a>5.1.3 补码的算数移位</h4><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-211035647.png" alt="mark"></p>
<ol>
<li><strong>正数的反码移位</strong></li>
</ol>
<ul>
<li>同原码</li>
</ul>
<ol start="2">
<li><strong>负数的反码移位</strong></li>
</ol>
<ul>
<li>右移除2，补位同反码 ，高位补1，低位舍弃</li>
<li>左移乘2，补码同原码 ，低位补0，高位舍弃</li>
<li>负数补码 = 反码末尾+1<ul>
<li>导致反码最右边几个连续的1都因进位而变为0，直到进位碰到第一个0为止</li>
</ul>
</li>
<li><strong>规律 ： 负数补码中，最右边的1及其右边同原码，最右边的左边同反码</strong></li>
</ul>
<h4 id="5-1-4-算数移位小结"><a href="#5-1-4-算数移位小结" class="headerlink" title="5.1.4 算数移位小结"></a>5.1.4 算数移位小结</h4><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-213119125.png" alt="mark"></p>
<h3 id="5-2-逻辑移位"><a href="#5-2-逻辑移位" class="headerlink" title="5.2 逻辑移位"></a>5.2 逻辑移位</h3><ul>
<li>看作对<strong>无符号数的算数移位</strong></li>
<li>左移右移都补0</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-213352208.png" alt="mark"></p>
<ol>
<li><strong>RGB的应用</strong></li>
</ol>
<ul>
<li>用3B来存储RGB的值</li>
<li>不断的右移就是RGB对应的机器码</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-213528606.png" alt="mark"></p>
<h3 id="5-3-循环移位"><a href="#5-3-循环移位" class="headerlink" title="5.3 循环移位"></a>5.3 循环移位</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-213703982.png" alt="mark"></p>
<ul>
<li>对于加法产生的进位超过数据字长<ul>
<li>计算机采用进位位（CF）来记录进位值的大小</li>
<li>具体左移右移如下所示</li>
<li><strong>作用：适合将数据的高位和低位进行调换（大端存储和小端存储）</strong></li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-213834957.png" alt="mark"></p>
<h3 id="5-4-小结"><a href="#5-4-小结" class="headerlink" title="5.4 小结"></a>5.4 小结</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-213948591.png" alt="mark"></p>
<h2 id="6-定点数的溢出"><a href="#6-定点数的溢出" class="headerlink" title="6. 定点数的溢出"></a>6. 定点数的溢出</h2><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-223331029.png" alt="mark"></p>
<ul>
<li>上溢：两个正数相加得到一个负数</li>
<li>下溢：两个负数相加得到一个正数</li>
</ul>
<p><strong>举例描述</strong></p>
<ul>
<li>三位二进制位的原码加法</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-221009343.png" alt="mark"></p>
<h3 id="6-1-原码加法的规则"><a href="#6-1-原码加法的规则" class="headerlink" title="6.1 原码加法的规则"></a>6.1 原码加法的规则</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-214826290.png" alt="mark"></p>
<h3 id="6-2-采用一位符号位"><a href="#6-2-采用一位符号位" class="headerlink" title="6.2 采用一位符号位"></a>6.2 采用一位符号位</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-221219755.png" alt="mark"></p>
<ul>
<li><strong>符合规律</strong><ul>
<li>正 + 正 = 负</li>
<li>负 + 负 = 正</li>
</ul>
</li>
</ul>
<h3 id="6-3-采用一位符号位并判断进位"><a href="#6-3-采用一位符号位并判断进位" class="headerlink" title="6.3 采用一位符号位并判断进位"></a>6.3 采用一位符号位并判断进位</h3><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-221821701.png" alt="mark"></p>
<ul>
<li><p>符号位的进位和最高数位的进位C1</p>
<ul>
<li>相同则说明没有溢出</li>
<li>否则表示发生了溢出</li>
</ul>
</li>
<li><p>计算机可以简单的通过异或两个进位的值运算得到是否产生溢出</p>
</li>
</ul>
<h3 id="6-4-采用双符号位"><a href="#6-4-采用双符号位" class="headerlink" title="6.4 采用双符号位"></a>6.4 采用双符号位</h3><ul>
<li><strong>双符号位又叫做模4补码</strong></li>
<li>正数的符号位是00</li>
<li>负数的符号位是11</li>
</ul>
<p><strong>结果规则：</strong></p>
<ul>
<li>符号位00 ：结果为正 无溢出</li>
<li>符号位11 :   结果为负 无溢出</li>
<li>10 ： 1表示原来的应该是负的 结果却是正的</li>
<li>01 ： 0表示原来的应该是正的 结果却是负的</li>
</ul>
<p><strong>举个例子：</strong></p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-222201396.png" alt="mark"></p>
<p><strong>注意：</strong></p>
<ul>
<li>使用双符号位：并不是有两个符号位，而是机器复制了一个符号位，这样并不会造成数据的扩展</li>
</ul>
<h3 id="6-5-溢出的原因"><a href="#6-5-溢出的原因" class="headerlink" title="6.5 溢出的原因"></a>6.5 溢出的原因</h3><ul>
<li><strong>目前的计算结果超出了机器字长所能表示的范围</strong></li>
</ul>
<p><strong>符号扩展</strong></p>
<ul>
<li><strong>正整数的扩展</strong><ul>
<li>在符号位后的高位补上0</li>
</ul>
</li>
<li><strong>负整数的扩展</strong><ul>
<li>原码：在符号位和数值位之间补0</li>
<li>反码：在符号位和数值位之间补1</li>
<li>补码：在符号位和数值位之间补1<ul>
<li>找到最右边的1</li>
<li>右半部分同原码</li>
<li>左半部分同反码</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-222841325.png" alt="mark"></p>
<p><strong>小数的扩展</strong></p>
<ul>
<li>正小数<ul>
<li>在尾部添加0</li>
</ul>
</li>
<li>负小数<ul>
<li>原码 ：在末尾添0</li>
<li>反码 ： 在末尾添1</li>
<li>补码 ： 在末尾添0<ul>
<li>找到最右边的1</li>
<li>右半部分同原码</li>
<li>左半部分同反码</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20210331-223229253.png" alt="mark"></p>

      
      <!-- reward -->
      
      <div id="reward-btn">
        打赏
      </div>
      
    </div>
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://zhuuu.work/2021/03/27/Compute_Organization/%E8%AE%A1%E7%BB%84-04-%E6%95%B0%E6%8D%AE%E7%9A%84%E8%A1%A8%E7%A4%BA/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80%E7%90%86%E8%AE%BA/" rel="tag">计算机基础理论</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BB%84%E6%88%90%E5%8E%9F%E7%90%86/" rel="tag">计算机组成原理</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2021/03/28/rabbitMQ/RabbitMQ-07-%E4%BA%A4%E6%8D%A2%E6%9C%BA%E7%B1%BB%E5%9E%8B/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            RabbitMQ-07-交换机类型
          
        </div>
      </a>
    
    
      <a href="/2021/03/26/rabbitMQ/RabbitMQ-06-%E6%A0%B8%E5%BF%83%E7%BB%84%E6%88%90%E9%83%A8%E5%88%86/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">RabbitMQ-06-核心组成部分</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        notify: false,
        verify: '',
        app_id: '',
        app_key: '',
        path: window.location.pathname,
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
<div class="gitalk" id="gitalk-container"></div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1.5.0/dist/gitalk.css">


<script src="https://cdn.jsdelivr.net/npm/gitalk@1.5.0/dist/gitalk.min.js"></script>


<script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.10.0/js/md5.min.js"></script>

<script type="text/javascript">
  var gitalk = new Gitalk({
    clientID: 'db188ed8c86dc4b0dbf3',
    clientSecret: 'a58f92160e5a9efd726b7d533000a0737f3e3f3e',
    repo: 'Blog-comments',
    owner: 'Zhuuuuuuuu',
    admin: ['Zhuuuuuuuu'],
    // id: location.pathname,      // Ensure uniqueness and length less than 50
    id: md5(location.pathname),
    distractionFreeMode: false,  // Facebook-like distraction free mode
    pagerDirection: 'last'
  })

  gitalk.render('gitalk-container')
</script>

  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2019-2021
        Zhuuu
      </li>
      <li>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
    <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
      <aside class="sidebar">
        <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="朱酱酱的学习博客"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/JVM/">JVM</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/JDK%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/">JDK源码</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/">多线程</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Mysql/">Mysql</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Redis/">Redis</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E8%AE%BE%E8%AE%A1%E8%80%85%E6%A8%A1%E5%BC%8F/">设计模式</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/MyBatis/">MyBatis</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/SpringMVC/">SpringMVC</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Spring/">Spring</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/SpringBoot/">SpringBoot</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/">Linux</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Leetcode/">Leetcode</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E5%89%8D%E7%AB%AF/">前端</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/">网络编程</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/photoshop/">photoshop</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="http://smartzhuuu.lofter.com/" target="_blank" rel="noopener">摄影</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
      </aside>
      <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
      
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/jquery.justifiedGallery.min.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<script src="/js/share.js"></script>



<script src="/fancybox/jquery.fancybox.min.js"></script>




<script>
  try {
    var typed = new Typed("#subtitle", {
    strings: ['昨夜西风凋碧树。独上高楼，望尽天涯路','衣带渐宽终不悔，为伊消得人憔悴。','众里寻他千百度。蓦然回首，那人却在，灯火阑珊处。'],
    startDelay: 0,
    typeSpeed: 200,
    loop: true,
    backSpeed: 100,
    showCursor: true
    });
  } catch (err) {
  }
  
</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer:'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>


<script>
  var ayerConfig = {
    mathjax: true
  }
</script>


<script src="/js/ayer.js"></script>


<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>



<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>


<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
  </div>
</body>

</html>